package com.hznu.ez4life.modules.controller;


import com.hznu.ez4life.modules.entity.Assess;
import com.hznu.ez4life.modules.service.AssessService;
import com.hznu.ez4life.myBeans.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author DragonDoor
 * @since 2019-07-25
 */
@RestController
@EnableAutoConfiguration
@RequestMapping("/assess")
public class AssessController {

    @Autowired
    AssessService assessService;

    @GetMapping("findListByEvaId/{evaId}")
    public R findListByEvaId(@PathVariable Integer evaId)
    {
        try
        {
            return R.ok().put("assessList",assessService.findListByevaId(evaId));
        }catch (Exception e)
        {
            e.printStackTrace();
            return R.error();
        }

    }
    @PostMapping("/addOne")
    public R addOne(@RequestBody Assess assess)
    {
        try
        {
            assessService.addOne(assess);
            return R.ok();
        }catch (Exception e)
        {
            e.printStackTrace();
            return R.error();
        }
    }
}

